package com.heima.common.util;

import com.heima.common.dto.User;

public class MediaThreadLocalUtil {
    //定义静态的变量
    private static ThreadLocal<User> threadLocal = new ThreadLocal<>();

    /**
     * 返回用户信息
     * @return
     */
    public static User get(){
        return threadLocal.get();
    }

    /**
     * 设置用户信息
     * @param user
     */
    public static void set(User user){
        threadLocal.set(user);
    }

    /**
     * 释放用户信息
     */
    public static void remove(){
        threadLocal.remove();
    }
}
